Printing each value of a node

Linked List Code Snippets

Created: 2022-06-26
Tags: #permanent


void print_list(node *head) {
    node *current = head;

    while (current != NULL) {
        printf("%d\n", current->val);
        current = current->next;  // Goes to next node
    }
}

References